<template>
  <div class="xtx-home-page">
    <div class="container">
      <homeCategory />
      <xtxCarousel :sliders="sliders" />
      <homeNew />
      <homeHot />
    </div>
  </div>
</template>

<script>
import { findBanner, findBrand } from '../../api/home'
import { reactive,ref } from 'vue'
import homeCategory from './components/home-category.vue'
import homeHot from './components/home-hot.vue'
import homeNew from './components/home-new.vue'
export default {
  name: 'xtx-home-page',
  components: {
    homeCategory,
    homeHot,
    homeNew
  },
  setup () {
    // 响应式的数据
    // const sliders = reactive([])

    // // 准备一个响应式的数据
    // findBanner().then(res => {
    //   // console.log('res:', res)
    //   // 赋值 不要直接赋值
    //   // 会更改数据的响应式特性
    //   sliders.push(...res.result)
    // })
    const sliders = ref([]);
    findBanner().then(res => {
        sliders.value=res.result
    })

    // 返回数据
    return {
      sliders
    }
  }
}
</script>

<style scoped lang="less"></style>
